<?php

$ergebnis=safe_query("SELECT * FROM ".PREFIX."clanwars ORDER BY date DESC LIMIT 0, ".$maxresults);
if(mysql_num_rows($ergebnis)){
	echo'<table width="100%" cellspacing="0" cellpadding="2">';
	$n=1;
	while($ds=mysql_fetch_array($ergebnis)) {

		$date=date("d.m.Y", $ds['date']);
		$homescr=array_sum(unserialize($ds['homescore']));
		$oppscr=array_sum(unserialize($ds['oppscore']));

		if($n%2) {
			$bg1=BG_1;
			$bg2=BG_2;
		}
		else {
			$bg1=BG_3;
			$bg2=BG_4;
		}

		if($homescr>$oppscr) $result='<font color="'.$wincolor.'">'.$homescr.':'.$oppscr.'</font>';
		elseif($homescr<$oppscr) $result='<font color="'.$loosecolor.'">'.$homescr.':'.$oppscr.'</font>';
		else $result='<font color="'.$drawcolor.'">'.$homescr.':'.$oppscr.'</font>';

		$resultID=$ds['cwID'];
		$gameicon="images/games/";
		if(file_exists($gameicon.$ds['game'].".gif")) $gameicon = $gameicon.$ds['game'].".gif";

		eval ("\$results = \"".gettemplate("results")."\";");
		echo $results;
		$n++;
	}
	echo'</table>';
}
?>
